import Cookies from 'js-cookie'

const TokenKey = 'campus_sh_market_admin_token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 用户类型枚举
export const UserType = {
  EMPTY: {
    type: '游客用户',
    des: 'ROLE_VISITOR',
    typeCode: -1
  },
  USER: {
    type: '普通用户',
    des: 'ROLE_USER',
    typeCode: 0
  },
  ADMIN: {
    type: '管理员',
    des: 'ROLE_ADMIN',
    typeCode: 1
  },
  SUPER_ADMIN: {
    type: '超级管理员',
    des: 'ROLE_SUPER_ADMIN',
    typeCode: 2
  }
}
